package com.fuyu.system.models.vo.menu;

import com.fuyu.system.entity.SysMenu;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
public class SysMenuListTreeVO extends SysMenu {

    private List<SysMenuListTreeVO> children = new ArrayList<>();


    /**
     * 转换成entity
     */
    public static SysMenuListTreeVO toVO(SysMenu sysMenu) {

        SysMenuListTreeVO sysMenuListTreeVO = new SysMenuListTreeVO();
        sysMenuListTreeVO.setMenuId(sysMenu.getMenuId());
        sysMenuListTreeVO.setParentId(sysMenu.getParentId());
        sysMenuListTreeVO.setPath(sysMenu.getPath());
        sysMenuListTreeVO.setComponent(sysMenu.getComponent());
        sysMenuListTreeVO.setRedirect(sysMenu.getRedirect());
        sysMenuListTreeVO.setTitle(sysMenu.getTitle());
        sysMenuListTreeVO.setIcon(sysMenu.getIcon());
        sysMenuListTreeVO.setSort(sysMenu.getSort());
        sysMenuListTreeVO.setTarget(sysMenu.getTarget());
        sysMenuListTreeVO.setMenuType(sysMenu.getMenuType());
        sysMenuListTreeVO.setVisible(sysMenu.getVisible());
        sysMenuListTreeVO.setIsRefresh(sysMenu.getIsRefresh());
        sysMenuListTreeVO.setMark(sysMenu.getMark());
        sysMenuListTreeVO.setRemark(sysMenu.getRemark());

        return sysMenuListTreeVO;
    }
}
